The Calendar
API in the Scripting app provides access to iOS calendars, calendar accounts, and event/reminder management.
Developers can retrieve default calendars, create new ones, list calendars supporting specific entity types, and manage calendar properties.
Represents types of calendars:
Value | Description |
---|---|
"birthday" |
Birthday calendar |
"calDAV" |
CalDAV protocol calendar |
"exchange" |
Exchange account calendar |
"local" |
Local calendar |
"subscription" |
Subscription calendar |
Represents the type of calendar account source:
Value | Description |
---|---|
"birthdays" |
Birthday account |
"calDAV" |
CalDAV account |
"exchange" |
Exchange account |
"local" |
Local account |
"mobileMe" |
MobileMe account |
"subscribed" |
Subscribed account |
Represents event availability settings:
Value | Description |
---|---|
"busy" |
Busy |
"free" |
Free |
"tentative" |
Tentative |
"unavailable" |
Unavailable |
Represents types of entities calendars can manage:
Value | Description |
---|---|
"event" |
Event |
"reminder" |
Reminder |
Represents a calendar account source (e.g., Local, Exchange).
Property | Type | Description |
---|---|---|
type |
CalendarSourceType |
The account source type |
title |
string |
The account source title |
identifier |
string |
The account source unique identifier |
getCalendars(entityType: CalendarEntityType): Promise<Calendar[]>
Gets the list of calendars for this source based on entity type.
entityType: CalendarEntityType
— The entity type to retrieve.Promise<Calendar[]>
— An array of calendar objects.Represents a calendar object that manages events and reminders.
Property | Type | Description |
---|---|---|
identifier |
string |
Unique identifier of the calendar |
title |
string |
Calendar title |
color |
Color |
Calendar color |
type |
CalendarType |
Calendar type |
source |
CalendarSource |
Calendar Source |
allowedEntityTypes |
CalendarEntityType |
Allowed entity types (event , reminder ) |
isForEvents |
boolean |
Whether the calendar is for events |
isForReminders |
boolean |
Whether the calendar is for reminders |
allowsContentModifications |
boolean |
Whether modifications are allowed |
isSubscribed |
boolean |
Whether the calendar is subscribed |
supportedEventAvailabilities |
CalendarEventAvailability |
Supported event availabilities |
remove(): Promise<void>
Deletes the calendar.
save(): Promise<void>
Saves changes to the calendar.
static defaultForEvents(): Promise<Calendar | null>
Gets the default event calendar set by the system.
static defaultForReminders(): Promise<Calendar | null>
Gets the default reminder calendar set by the system.
static forEvents(): Promise<Calendar[]>
Lists all calendars that support events.
static forReminders(): Promise<Calendar[]>
Lists all calendars that support reminders.
static create(options: { title: string, entityType: CalendarEntityType, sourceType: CalendarSourceType, color?: Color }): Promise<Calendar>
Creates a new calendar.
title: string
— Calendar titleentityType: CalendarEntityType
— Supported entity typesourceType: CalendarSourceType
— Account source typecolor?: Color
— (Optional) Calendar colorPromise<Calendar>
— The newly created calendar.static presentChooser(allowMultipleSelection?: boolean): Promise<Calendar[]>
Presents a calendar chooser view.
allowMultipleSelection?: boolean
— Allow multiple selection, default false
.Promise<Calendar[]>
— Selected calendars.static getSources(): CalendarSource[]
Retrieves all available calendar sources on the device.